package com.uwlaser.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
import com.uwlaser.base.CommonModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
* @author zk-Qin
* @date 2022-05-11
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("plan_work_order")
public class DataPlanWorkOrder extends CommonModel<DataPlanWorkOrder> implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "ID")
    @TableId(type= IdType.AUTO)
    private Integer id;

    @ApiModelProperty(value = "工单编号")
    @NotBlank
    private String workOrderCode;

    @ApiModelProperty(value = "订单编号")
    @NotBlank
    private String orderCode;

    @ApiModelProperty(value = "工单状态")
    private String orderStatus;

    @ApiModelProperty(value = "产品型号")
    private String productCode;

    @ApiModelProperty(value = "产品类型")
    private String productType;

    @ApiModelProperty(value = "需求数量")
    private Integer requiredQty;

    @ApiModelProperty(value = "产线编号")
    private String lineCode;

    @ApiModelProperty(value = "工段编号")
    private String sectionCode;

    @ApiModelProperty(value = "计划开始")
    private String planStart;

    @ApiModelProperty(value = "计划结束")
    private String planEnd;

    @ApiModelProperty(value = "实际开始时间")
    private String practicalStart;

    @ApiModelProperty(value = "实际结束时间")
    private String practicalEnd;

    @ApiModelProperty(value = "客户名称")
    private String clientName;

    @ApiModelProperty(value = "计划员")
    private String planner;

    @ApiModelProperty(value = "总数量(条码数量）")
    private Integer totalQty;

    @ApiModelProperty(value = "完成数量（OK数量）")
    private Integer finishQty;

    @ApiModelProperty(value = "失败数量（NG数量）")
    private Integer failQty;

    @ApiModelProperty(value = "在线数量")
    private Integer onlineQty;

    @ApiModelProperty(value = "报废数量")
    private Integer scrapQty;

    @ApiModelProperty(value = "未完成数量")
    private Integer unfinishQty;

    @ApiModelProperty(value = "描述")
    private String remark;

    @ApiModelProperty(value = "创建人")
    @TableField(fill= FieldFill.INSERT)
    private String createBy;

    @ApiModelProperty(value = "创建时间")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;

    @ApiModelProperty(value = "更新人")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private String updateBy;

    @ApiModelProperty(value = "更新时间")
    @TableField(fill= FieldFill.INSERT_UPDATE)
    private Date updateTime;

    public void copyFrom(DataPlanWorkOrder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
